<CLabel@Label>:
    color: kivy.utils.get_color_from_hex('#0081CF')
    font_size: 30  # 24
    size_hint: 0.6, 0.08
    markup: True
    text_size: self.size

<PreferencesPage>:
    canvas.before:
        Color:
            rgba: [1,1,1,1]
        Rectangle:
            pos: self.pos
            size: self.size

    FloatLayout:

        CLabel:
            id: 'engine'
            text: '[ref="click"][b]Translation Engine:[/b][/ref]'
            pos_hint: {'x':0.15,'y': 0.8}
        CLabel:
            id: 'language'
            text: '[ref="click"][b]Language Setting:[/b][/ref]'
            pos_hint: {'x':0.15,'y': 0.6}

        CLabel:
            text: '[ref="click"][b]Threads Setting:[/b][/ref]'
            pos_hint: {'x':0.15,'y': 0.4}
        Label:
            text: '(For higher speed)'
            pos_hint: {'x':0.15,'y': 0.35}
            color: kivy.utils.get_color_from_hex('#000000')
            size_hint: 0.8,0.2
            markup: True
            text_size: self.size
        Spinner:
            id: 'engine_setting'
            size_hint: 0.2, 0.08
            pos_hint: {'x':0.7, 'y': 0.8}
            text: root.config.default_engine
            values: 'google', 'tencent'
            on_text:
                root.engine_show_load(self.text)
        BoxLayout:
            orientation: 'horizontal'
            size_hint: 0.2, 0.08
            pos_hint: {'x':0.7, 'y': 0.6}

            Button:
                id: language_setting
                text: " "
                markup: True
                on_press:root.language_show_load()

        Button:
            id: EditThreadsButton
            size_hint: 0.2, 0.08
            pos_hint: {'x':0.7, 'y': 0.4}
            text: (str(root.config.default_threads) if root.config.default_threads != 0 else 'auto') + " Threads"
            on_press:root.threads_show_load(root.config.default_threads)
            markup: True
            disabled: True if root.config.default_engine == 'tencent' else False


        BoxLayout:
            orientation: 'horizontal'
            size_hint: (1,.1)
            spacing: 50
            padding: 50,0
            pos_hint: {"center_x":0.5,"y":0.1}

            Button:
                text: "[b]Back to Index[/b]"
                markup: True
                on_press:root.back_index()

<EngineDialog>:
    BoxLayout:
        size: root.size
        pos: root.pos
        orientation: "vertical"
        padding: 10
        spacing: 100
        BoxLayout:
            size_hint: 0.9, 0.2
            Label:
                id: 'TencentID '
                text: '[ref="click"][b]Tencent secretID:[/b][/ref]'
                color: kivy.utils.get_color_from_hex('#FFFFFF')
                font_size: 24  # 24
                markup: True
                size_hint_y: .2
            TextInput:
                id: id_input
                size_hint_y: .4
                multiline: False
                text: root.id

        BoxLayout:
            pos_hint_y: 0
            size_hint: 0.9, 0.2
            Label:
                id: 'TencentKey '
                text: '[ref="click"][b]Tencent secretKey:[/b][/ref]'
                color: kivy.utils.get_color_from_hex('#FFFFFF')
                font_size: 24  # 24
                markup: True
                size_hint_y: .2

            TextInput:
                id: key_input
                size_hint_y: .4
                multiline: False
                text: root.key

        BoxLayout:
            spacing: 30
            size_hint_y: .1
            Button:
                text: "[b]Confirm[/b]"
                on_release: root.load(id_input.text,key_input.text)
                markup: True

            Button:
                text: "[b]Cancel[/b]"
                on_release: root.cancel()
                markup: True

<LanguageDialog>:
    BoxLayout:
        size: root.size
        pos: root.pos
        orientation: "vertical"
        padding: 10
        spacing: 100

        BoxLayout:

            BoxLayout:
                orientation: 'vertical'
                Label:
                    text: '[ref="click"][b]Translate from:[/b][/ref]'
                    color: kivy.utils.get_color_from_hex('#FFFFFF')
                    font_size: 24  # 24
                    markup: True
                    size_hint_y: .2
                ScrollView:
                    size_hint: 1, 0.8
                    do_scroll_x: False
                    do_scroll_y: True

                    Spinner:
                        id:trans_from
                        size_hint: 1, 0.2
                        text: root.lang_from_show
                        values: root.lang_list

            BoxLayout:
                orientation: 'vertical'
                Label:
                    text: '[ref="click"][b]to:[/b][/ref]'
                    color: kivy.utils.get_color_from_hex('#FFFFFF')
                    font_size: 24  # 24
                    markup: True
                    size_hint_y: .2
                ScrollView:
                    size_hint: 1, 0.8
                    do_scroll_x: False
                    do_scroll_y: True

                    Spinner:
                        id:trans_to
                        size_hint: 1, 0.2
                        text: root.lang_to_show
                        values: root.lang_list

        BoxLayout:
            spacing: 30
            size_hint_y: .1
            Button:
                text: "[b]Confirm[/b]"
                on_release: root.load(trans_from.text,trans_to.text)
                markup: True

            Button:
                text: "[b]Cancel[/b]"
                on_release: root.cancel()
                markup: True

<ThreadsDialog>:
    BoxLayout:
        size: root.size
        pos: root.pos
        orientation: "vertical"
        padding: 10
        spacing: 100
        BoxLayout:
            size_hint: 0.9, 0.2
            Label:
                id: 'AutoAdjustLabel'
                text: '[ref="click"][b]Automatically Adjust:[/b][/ref]'
                color: kivy.utils.get_color_from_hex('#FFFFFF')
                font_size: 24  # 24
                markup: True
                size_hint_y: .2
            CheckBox:
                id: AutoAdjustCheckBox
                size_hint_y: .4
                active: root.threads == 0
                on_state: root.checkbox_update(self.active, ThreadNumberInput)

        BoxLayout:
            pos_hint_y: 0
            size_hint: 0.9, 0.2
            Label:
                id: 'ThreadNumberLabel'
                text: '[ref="click"][b]Threads:[/b][/ref]'
                color: kivy.utils.get_color_from_hex('#FFFFFF')
                font_size: 24  # 24
                markup: True
                size_hint_y: .2

            TextInput:
                id: ThreadNumberInput
                size_hint_y: .4
                multiline: False
                text: str(root.threads) if root.threads != 0 else 'auto'
                input_filter: 'int'
                readonly: root.threads == 0
                disabled: root.threads == 0
                on_text: root.textinput_update(self.text)

        BoxLayout:
            spacing: 30
            size_hint_y: .1
            Button:
                text: "[b]Confirm[/b]"
                on_release: root.load()
                markup: True
            Button:
                text: "[b]Cancel[/b]"
                on_release: root.cancel()
                markup: True
